<?php
    
    include "db.php";
    
    $query = "SELECT originating_address, message_body FROM sms ORDER BY smsid DESC LIMIT 1";
    $result = mysql_query(stripslashes($query), $connect);
    
//    $num_rows = mysql_num_rows($result);
    mysql_close($connect);
    
    $row = mysql_fetch_array($result);
    
    $originating_address = $row[originating_address];
    $message_body = $row[message_body];
    
    echo "{";
    echo "\"originating_address\":".$originating_address.",";
    echo "\"message_body\":"."\"".$message_body."\" }";
    
?>